<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml"
      xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="content-type" content="no-cache, must-revalidate" />
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT"/>
    <title>比赛信息</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/nav.css">
    <link rel="stylesheet" href="../css/font-awesome.css">
    <link rel="stylesheet" href="../css/element/index.css">
	<link rel="stylesheet" href="../css/hsg.css">

   
</head>
<body>
<div id="wrapper" v-cloak>
    <div >
        <div style="padding: 0 20px">
            <div>
                <div style="color: #666; font-weight: bold; border-bottom: 1px solid #ccc; padding: 10px 0; margin-bottom: 20px; font-size: 30px;">比赛信息添加</div>
            </div>
            <div style="margin-top: 10px">
                <div style="border: 1px solid #ff6b31;">
                    <div style="padding: 5px; border-bottom: 1px solid #ff6b31; color: white; background-color: #ff6b31;">比赛信息添加</div>
                    <br>
           
            <form class="form-horizontal">
                <input type="hidden" id="id" name="id" v-model="entity.id">
               <div  class="form-group"><label class="col-sm-3 control-label">参赛编号</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.cansaibianhao" style="width: 160px" placeholder="请输入参赛编号" disabled id="cansaibianhao"></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">报名编号</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.baomingbianhao" style="width: 160px" placeholder="请输入报名编号" id="baomingbianhao" disabled ></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">赛事名称</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.saishimingcheng" style="width: 160px" placeholder="请输入赛事名称" id="saishimingcheng" disabled ></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">赛事地点</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.saishididian" style="width: 160px" placeholder="请输入赛事地点" id="saishididian" disabled ></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">用户名</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.yonghuming" style="width: 160px" placeholder="请输入用户名" id="yonghuming" disabled ></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">姓名</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.xingming" style="width: 160px" placeholder="请输入姓名" id="xingming" disabled ></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">性别</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.xingbie" style="width: 160px" placeholder="请输入性别" id="xingbie" disabled ></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">身份证</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.shenfenzheng" style="width: 160px" placeholder="请输入身份证" id="shenfenzheng" disabled ></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">手机号</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.shoujihao" style="width: 160px" placeholder="请输入手机号" id="shoujihao" disabled ></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">是否获名次</label><div class="col-sm-7"><select class="form-control" v-model="entity.shifouhuomingci"><option value="无">无</option><option value="金牌">金牌</option><option value="银牌">银牌</option><option value="铜牌">铜牌</option></select></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">比赛成绩</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.bisaichengji" style="width: 160px" placeholder="请输入比赛成绩" id="bisaichengji"></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">添加人</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.tianjiaren" style="width: 160px" placeholder="请输入添加人" id="tianjiaren"  ></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">备注</label><div class="col-sm-7"><textarea type="text" class="form-control" v-model="entity.beizhu" style="height: 100px" placeholder="请输入备注" id="beizhu"></textarea></div></div>
		
            </form>

            <div class="modal-footer">
                <button type="button" class="btn btn-primary" @click="update">保存</button>
            </div>
        </div>
        </div>
        </div>
    </div>

</div>


<script src="../js/jquery-1.10.2.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/nav.js"></script>
<script src="../js/my.js"></script>
<script src="../js/vue2.6.11/vue.min.js"></script>
<script src="../js/vue2.6.11/axios.js"></script>
<script src="../js/element/index.js"></script>

<script>
    function checkValid(entity) {
       
        
        return true;
    }
   
    new Vue({
        el: '#wrapper',
        data: {
            bisaixinxiid: 0,
           //hsgdanhejisuan
            bisaixinxiInfo: {},
            isShow: false,
            user: {},
            entity:{
            },
        },
        created: function () {
            axios.get('/auth').then(res => {
                if (res.data.code === '0') {
                    this.user = res.data.data;
                }
            });
            this.saishibaomingid = this.getQueryVariable('saishibaomingid');
            this.loadBisaixinxiInfo();
			this.user = JSON.parse(localStorage.getItem('user'));
		 
        },
        methods: {
            loadBisaixinxiInfo() {
                axios.get("/saishibaomingInfo/" + this.saishibaomingid).then(res => {
                    if (res.data.code === '0') {
                        const saishibaoming = res.data.data;
                        this.entity = {baomingbianhao:saishibaoming.baomingbianhao,saishimingcheng:saishibaoming.saishimingcheng,saishididian:saishibaoming.saishididian,yonghuming:saishibaoming.yonghuming,xingming:saishibaoming.xingming,xingbie:saishibaoming.xingbie,shenfenzheng:saishibaoming.shenfenzheng,shoujihao:saishibaoming.shoujihao}
						   this.entity.cansaibianhao = uuid(); 
						//tupianloadtb
						//dhjsuanxx
                    } else {
                        alert(res.data.msg);
                    }
                });
            },
			getQueryVariable(variable) {
                let query = window.location.search.substring(1);
                let vars = query.split("&");
                for (let i = 0; i < vars.length; i++) {
                    let pair = vars[i].split("=");
                    if (pair[0] === variable) {
                        return pair[1];
                    }
                }
                return '';
            },
			//yofujifsuan2
           
			
			//m_liangbuinit
			
			update() {
                if (checkValid(this.entity)) {
                    axios.post(
                        "/bisaixinxiInfo", this.entity
                    ).then(res => {
                        if (res.data.code === '0') {
                            msg('success', '添加成功');
                        } else {
                            msg('error', res.data.msg);
                        }
                    })
                }
            },
			//m_tupiansccsbaul
           
            downModel() {
                location.href = '/bisaixinxiInfo/getExcelModel';
            },
            clickUpload: function (e) {
                if (this.user.level === "管理员")
                {}
                else
                {
                    msg('warning', '你没有权限操作');
                    return;
                }
            },
            upload: function () {
                let files = this.$refs.file.files;
                for (let i = 0; i < files.length; i++) {
                    let formData = new FormData();
                    formData.append('file', files[i]);
                    axios.post('/bisaixinxiInfo/upload', formData, {
                        'Content-Type': 'multipart/form-data'
                    }).then(res => {
                        if (res.data.code === '0') {
                            msg('success', '批量导入成功');
                            this.loadTable(1);
                        } else {
                            msg('error', res.data.msg);
                        }
                    })
                }
            },
			
			//youscwenjian
            
			//x2suilafuxzhi
           
        }
    })
</script>
</body>
</html>
